{% extends "base.html" %}
{% set title = _('Media Gallery Search') %}
{% set styles= ('gallery',) %}
{% set scripts = ('wiki',) %}
{% set crumbs = [(url('gallery.gallery', media_type), _('Media Gallery')),
                 (None, _('Search'))] %}

{% block above_main %}
  <h1>{{ _('Media Gallery') }}</h1>
{% endblock %}

{% block content %}
  <article id="gallery-list" class="main">
    <div class="cf">
      <div class="grid_6">
        <form action="{{ url('gallery.search', media_type) }}" method="get" class="simple-search-form" id="gallery-search">
          <input class="searchbox" type="search" autocomplete="off" name="q" required="required" placeholder="{{ _('Search Gallery') }}" />
          <button class="submit-button" title="{{ _('Search') }}" type="submit">
          </button>
        </form>
      </div>

      <div class="grid_6">
        <div id="locale-filter">
          <form action="" method="get">
            <label for="select-locale">{{ _('Show media for:') }}</label>
            <select id="select-locale" name="lang" class="autosubmit">
              {% for lang in settings.LANGUAGE_CHOICES %}
                <option value="{{ lang[0] }}" {% if lang[0] == request.LANGUAGE_CODE %}selected="selected"{% endif %}>{{ lang[1] }} ({{ lang[0] }})</option>
              {% endfor %}
            </select>
            <noscript>
              <input type="submit" value="{{ _('Go') }}">
            </noscript>
          </form>
        </div>
        <div id="media-type-filter">
          <span>{{ _("Show:") }}</span>
          <select id="media-type-select">
            <option {% if media_type == 'image' %}selected="selected"{% endif %} value="{{ url('gallery.search', 'image')|urlparams(q=q) }}">{{ _('Images') }}</option>
            <option {% if media_type == 'video' %}selected="selected"{% endif %} value="{{ url('gallery.search', 'video')|urlparams(q=q) }}">{{ _('Videos') }}</option>
          </select>
          <noscript>
            <a href="{{ url('gallery.search', 'image')|urlparams(q=q) }}">{{ _('Images') }}</a> |
            <a href="{{ url('gallery.search', 'video')|urlparams(q=q) }}">{{ _('Videos') }}</a>
          </noscript>
        </div>
      </div>
    </div>

    {% with media_list=media %}
      {% include 'gallery/includes/media_list.html' %}
    {% endwith %}
  </article>
{% endblock %}
